package com.example.wisdomclassroomapi.application.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.wisdomclassroomapi.domain.entity.AuthRoleEntity;
import com.example.wisdomclassroomapi.domain.service.AuthRoleDomainService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Package: com.example.wisdomclassroomapi.application.service
 * @Description: <>
 * @Author: scholes
 * @CreateDate: 2022-04-18
 * @UpdateUser: scholes
 * @UpdateDate: 2022-04-18
 * @UpdateRemark: <>
 * @Version: 1.0
 */
@Service
public class AuthRoleApplicationService {
    @Resource
    private AuthRoleDomainService authRoleDomainService;

    public void add(AuthRoleEntity entity) {
        authRoleDomainService.add(entity);
    }

    public AuthRoleEntity findById(String id) {
        return authRoleDomainService.findById(id);
    }

    public int updateById(AuthRoleEntity entity) {
        return authRoleDomainService.updateById(entity);
    }

    public int deleteById(String id) {
        return authRoleDomainService.deleteById(id);
    }

    public IPage<AuthRoleEntity> page(AuthRoleEntity entity, IPage page) {
        return authRoleDomainService.page(entity, page);
    }

    public List<AuthRoleEntity> list(AuthRoleEntity entity) {
        return authRoleDomainService.list(entity);
    }

    public List<String> listRoleId(AuthRoleEntity entity) {
        List<AuthRoleEntity> list = authRoleDomainService.list(entity);
        List<String> ids = new ArrayList<>();
        list.forEach(authRoleEntity -> {
            ids.add(authRoleEntity.getId());
        });

        return ids;
    }

}